package com.dhh.activity;

import com.dhh.dao.DataBaseHelper;
import com.dhh.util.manager.GoalManager;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;

public class NavigateActivity extends Activity{
	private DataBaseHelper db;
	private GoalManager gManager;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);	
		db = new DataBaseHelper(getBaseContext());
        db.openDataBase();
        gManager = new GoalManager(db);
        
        Intent intent = null;
        if(gManager.getCurrentGoal().getId()!=null){
        	intent = new Intent(NavigateActivity.this,HomeActivity.class);
        }else{

        	intent = new Intent(NavigateActivity.this,GoalActivity.class);
        }
		startActivity(intent);
	}
	
	@Override
	protected void onStop(){
		super.onStop();
		if (db != null) {
			db.close();
		}
	}
}
